<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * 公司和模块关系中间表
 * 用于保存公司购买的增值服务
 *
 * Date: 21/03/2018
 * @author George
 */
class CompanyModuelePivotTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('company_module_pivot', function (Blueprint $table) {
            $table->unsignedInteger('company_id')->index();
			$table->string('module_code')->index();
			$table->primary(['company_id', 'module_code']);
			$table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('company_module_pivot');
    }
}
